/*
	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Library General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
*/

#ifndef SEARCHBOXIMPL_H
#define SEARCHBOXIMPL_H
//
#include "ui_searchbox.h"
//
#include "searchthread.h"

class SearchBoxImpl : public QWidget, public Ui::SearchDlg
{
	Q_OBJECT
public:
	SearchBoxImpl( QWidget * parent = 0, Qt::WFlags f = 0);
	void setTree(QTreeWidget *tree);
	void setModel(Model *model);
	
private slots:
	void on_btnSearch_clicked();	
	void onSearchFinished();
	void onTreeDblClick(QTreeWidgetItem *treeItem, int col);	

signals:
	void onSearchSelectionTriggered(QTreeWidgetItem *treeItem, int selStart, int selLenght);

private:
	QTreeWidget *m_tree;
	Model *m_model;
	SearchThread *m_searchThread;
	QList<SearchResultItem *> *m_results;
	
	QTreeWidgetItem *m_pageRoot;
	QTreeWidgetItem *m_categoryRoot;
	
	QString m_searchTerm;
	
	void purgeResults();
	
};
#endif










